<?php
declare(strict_types=1);
namespace Dao;
// hook dao_sys_role_use.php

use Field\SysRoleConst;
use Model\SysRoleModel;

class SysRoleDao extends SysRoleModel
{
	// hook dao_sys_role_public_start.php
	protected array $add_rule	=	[];
    protected array $edit_rule	=	[];

    public array $data_array= [];
    public array $data_kv=[];

    protected array $rule	=	[
		/*
		"mobile"=>[
			"max"=>3
			"min"=>3
			"func"=>'isMobile'
			"error"=>false,
			'message'=>'格式有误'
		],
		"username"=>[
			"max"=>3
			"min"=>3
			"func"=>'checkS'
			"error"=>false,
			'message'=>'格式有误'
		],
		*/
	];
	//数据，字段，验证规则
	/*
	function isMobile($data,$field,$val){
	
		return true;
	}
	*/
	
	// hook dao_sys_role_public_end.php

    public function auto_load(): void
    {
        $this->reload();
    }

    public function reload(array $cond=[]): void
    {
        $cache = $this->select();
        $this->data_kv = arrlist_key_values($cache, SysRoleConst::RoleID, SysRoleConst::RoleName);
        $this->data_array = $cache;
    }
	// hook dao_sys_role_end.php
}
?>